<template>
  <BasicTable :columns="columns" :data-source="tableData" rowKey="film_id">
    <template #bodyCell="{ column, record }">
      <template v-if="column.dataIndex === 'category'">
        <span
          >{{ record.category || '-' }}
          <span v-if="record.sub_category">{{ '/' + record.sub_category || '-' }}</span></span
        >
        <!-- <BindingClassificationText :value="record.classifySubclassesVal" v-if="record.isBind === 0" /> -->
      </template>
      <template v-if="column.dataIndex === 'update_time'">
        <span>{{ formatToDateTime(record.update_time * 1000) }}</span>
      </template>
      <template v-if="column.dataIndex === 'is_collect'">
        <CollectState :value="record.is_collect ? 1 : 2" :collect-state="COLLECT_START_STATE_4" />
      </template>
    </template>
  </BasicTable>
</template>

<script lang="ts" setup name="SeedSourceMovieTable">
import { reactive, ref } from 'vue'
import { formatToDateTime } from '@/utils/format'
import BasicTable from '../../../../components/BasicTable.vue'
import BindingClassificationText from '../../../../components/binding-classification/BindingClassificationText.vue'
import CollectState from '../../../../components/CollectState.vue'
import { COLLECT_START_STATE_4 } from '@/stores/modules/collect-manage/select-data-source'
import { getTableData, tableData } from '../../../../hooks/useTable'

getTableData()
const columns = [
  {
    title: '内容ID',
    dataIndex: 'film_id'
  },
  {
    title: '影片名称',
    dataIndex: 'name'
  },
  {
    title: '分类/子类',
    dataIndex: 'category'
  },
  // {
  //   title: '种源节点标识',
  //   dataIndex: 'SeedSourceIdentification'
  // },
  {
    title: '更新时间',
    dataIndex: 'update_time'
  },
  {
    title: '是否已采集',
    dataIndex: 'is_collect'
  }
]

// type TableData = {
//   key: string
//   contentId: string
//   movieName: string
//   classifySubclasses: string
//   classifySubclassesVal: number
//   SeedSourceIdentification: string
//   updateTime: number
//   isCollect: number
//   isBind: number
// }[]
// const tableData = reactive<TableData>([
//   {
//     key: '1',
//     contentId: '001',
//     movieName: '杀破狼',
//     classifySubclasses: '电影 / 动作片',
//     classifySubclassesVal: 1,
//     SeedSourceIdentification: 'aaaaa',
//     updateTime: Date.now(),
//     isCollect: 1,
//     isBind: 1
//   },
//   {
//     key: '2',
//     contentId: '002',
//     movieName: '怦然心动',
//     classifySubclasses: '电影 / 喜剧片',
//     classifySubclassesVal: 2,
//     SeedSourceIdentification: 'bbbbb',
//     updateTime: Date.now(),
//     isCollect: 2,
//     isBind: 0
//   }
// ])
</script>
